<template>
    <div id="app"
         style="height: 84vh;">
        <img v-if="start"
             src="@/assets/images/app_logo.png"
             style="position: absolute;width: 100%;height:100%;z-index: 999">
        <router-view v-if="!start">
        </router-view>
        <mu-dialog title="提示"
                   width="360"
                   :open.sync="activity_tips">
            <pre>   四月春光烂漫，四月春风轻灵，正值第23个“世界读书日”的四月天，为倡导广大读者多读书，读好书，让读书成为一种时尚，让学习成为一种习惯，图书馆举办“享”读书系列活动——“享”念，征集最美声音并开展评选活动。</pre>
            [点击查看]<a :href="link" target="here">“享念”活动的推送页面</a>
            <p>[点击查看]<a @click="gotoAbout">关于页面</a></p>
            <mu-button slot="actions"
                       flat color="primary"
                       @click="closeActivityTips(false)">
                以后不再提醒
            </mu-button>
            <mu-button slot="actions"
                       flat
                       color="primary"
                       @click="closeActivityTips">
                我知道了
            </mu-button>
        </mu-dialog>
    </div>
</template>
<script>

    export default {
        components: {},
        data() {
            return {
                activity_tips: false,
                start: true,
                link: 'https://mp.weixin.qq.com/s/qjhNQNZTVmG8xQQVCNnxUg'
            }
        },
        name: 'app',
        beforeCreate() {
        },
        created() {
            setTimeout(this.hideStartPage, 1500)
            let come = localStorage.getItem('declaimer_come_in')
            if (come === null) {
                localStorage.setItem('declaimer_come_in', "1")
            } else {
                localStorage.setItem('declaimer_come_in', parseInt(come) + 1)
            }
            this.$theme.add(this.$store.state.theme.name, this.$store.state.theme, 'light')
            this.$theme.use(this.$store.state.theme.name)
        },
        methods: {
            gotoAbout() {
                this.$router.push('/declaimer/about')
                this.closeActivityTips()
            },
            closeActivityTips(flag) {
                if (flag != null && flag === false) {
                    localStorage.setItem('declaimer_no_tips', "true")
                }
                this.activity_tips = false
            },
            hideStartPage() {
                this.start = false
                let no_tips = localStorage.getItem('declaimer_no_tips')
                if (no_tips == null || no_tips !== 'true') {
                    this.activity_tips = true
                }
            }
        },
        mounted() {
        }
    }
</script>

<style lang="stylus">
    .mu-dialog
        border-radius 12px
</style>
